package com.hieuzest.citsaw;

import com.hieuzest.citsaw.beam.Jigsaw;
import com.hieuzest.citsaw.beam.NearbyPieces;
import com.hieuzest.citsaw.beam.RequestBody;
import com.hieuzest.citsaw.beam.ResultBody;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;

/**
 * Created by Giraffe on 2017/11/25.
 */

public interface WebService {

    public static final String SERVER = "http://192.168.43.244:5000/";

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("api/getJigsaw")
    public Call<Jigsaw> getJigsaw(@Body RequestBody body);

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("api/findPieces")
    public Call<NearbyPieces> findPieces(@Body RequestBody body);

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("api/getAllInfo")
    public Call<com.hieuzest.citsaw.beam.ResponseBody> getAllInfo(@Body RequestBody body);

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("api/markPiece")
    public Call<ResultBody> markPiece(@Body RequestBody body);

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("api/catchPiece")
    public Call<ResultBody> catchPiece(@Body RequestBody body);

    WebService service = new Retrofit.Builder()
            .baseUrl(SERVER)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
            .create(WebService.class);
}
